package com.llg.service;

import com.llg.mapper.LedMatchReceiveMapper;
import com.llg.model.code.CommonCode;
import com.llg.model.response.DataResult;
import com.llg.model.response.ResponseResult;
import com.llg.pojo.LedMatchReceive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LedMatchReceiveService {

    @Autowired
    private LedMatchReceiveMapper ledMatchReceiveMapper;

    //通过id查
    public DataResult<LedMatchReceive> findById(int id){
        return new DataResult<>(CommonCode.SUCCESS, ledMatchReceiveMapper.selectByPrimaryKey(id));
    }

    //增
    public DataResult<LedMatchReceive> add(LedMatchReceive ledMatchReceive){
        ledMatchReceiveMapper.insertSelective(ledMatchReceive);
        return new DataResult<>(CommonCode.SUCCESS, ledMatchReceive);
    }

    //删
    public ResponseResult delete(int id){
        ledMatchReceiveMapper.deleteByPrimaryKey(id);
        return new ResponseResult(CommonCode.SUCCESS);
    }

    //改
    public ResponseResult update(LedMatchReceive ledMatchReceive){
        ledMatchReceiveMapper.updateByPrimaryKeySelective(ledMatchReceive);
        return new ResponseResult(CommonCode.SUCCESS);
    }
}
